#!/bin/sh

# set -x

app=$1

[ "_${app}" == "_" ] && app=`basename ${PWD}`

cat > Makefile << EOF
#
# Makefile
#

HDRS=\$(wildcard *.h)
SRCS=\$(wildcard *.c)
OBJS:=\$(SRCS:.c=.o)

APP=${app}

CC=gcc

CFLAGS += -g -Wall -std=gnu99
CPPFLAGS +=
LDFLAGS +=

.PHONY:
all: \$(APP)

\$(APP): \$(OBJS)

.PHONY:
clean:
	-rm -rf \$(OBJS)
	-rm -rf \$(APP)


EOF

cat > ${app}.c << EOF
#include <stdio.h>

int main(int argc, char ** argv)
{
	printf(" this is ${app} \n");
	return 0;
}


EOF

